﻿using System;
using System.Collections.Generic;
using GA.Server.Api;
using GA.Server.Configuration;
using GA.Server.ConnectionListener;
using GA.Server.Objects;
using GA.Shared.Interfaces;
using GA.Shared.Objects;

namespace GA.Server.Managers
{
    public class MapManagerServer : GAServer, IObjectServer
    {
        public override string Name
        {
            get { return "MapManagerServer"; }
        }

        public MapManagerServer()
        {
        }

        public MapManagerServer(ServerPropertiesElementCollection collection)
            : base(collection)
        {
            Log.Info("Starting MapManagerServer...");

            mMaps = new Dictionary<int, DatabaseZone>();
            mHexes = new Dictionary<int, DatabaseHex>();
            mResources = new Dictionary<int, DatabaseResource>();
        }

        public override void RegisterServer(GAServer newServer)
        {
            if (newServer is ConnectionListenerServer)
            {
                ((ConnectionListenerServer)newServer).RegisterObjectServer<Zone>(this);
                ((ConnectionListenerServer)newServer).RegisterObjectServer<Hex>(this);
                ((ConnectionListenerServer)newServer).RegisterObjectServer<Resource>(this);
            }
        }

        private Dictionary<int, DatabaseZone> mMaps;
        private Dictionary<int, DatabaseHex> mHexes;
        private Dictionary<int, DatabaseResource> mResources;



        #region IObjectServer Members

        public SerializableTransferObject CreateObject(SerializableTransferObject authorizedUser, SerializableTransferObject newObject)
        {
            #warning Not Implemented
            throw new NotImplementedException();
        }

        public void EditObject(SerializableTransferObject authorizedUser, SerializableTransferObject editObject)
        {
            #warning Not Implemented
        }

        public void DeleteObject(SerializableTransferObject authorizedUser, SerializableTransferObject deleteObject)
        {
            #warning Not Implemented
        }

        public SerializableTransferObject GetObject(SerializableTransferObject authorizedUser, string type, Dictionary<string, object> parameters)
        {
            #warning Not Implemented
            throw new NotImplementedException();
        }

        public IEnumerable<SerializableTransferObject> GetObjects(SerializableTransferObject authorizedUser, string type, Dictionary<string, object> parameters)
        {
            #warning Not Implemented
            throw new NotImplementedException();
        }

        #endregion
    }
}
